Source File
shortiterator.go
Belonging Package
github.com/RoaringBitmap/roaring/v2
package roaringtype shortIterable interface {hasNext() boolnext() uint16}type shortPeekable interface {shortIterablepeekNext() uint16advanceIfNeeded(minval uint16)}type shortIterator struct {slice []uint16loc int}func ( *shortIterator) () bool {return .loc < len(.slice)}func ( *shortIterator) () uint16 {:= .slice[.loc].loc++return}func ( *shortIterator) () uint16 {return .slice[.loc]}func ( *shortIterator) ( uint16) {if .hasNext() && .peekNext() < {.loc = advanceUntil(.slice, .loc, len(.slice), )}}type reverseIterator struct {slice []uint16loc int}func ( *reverseIterator) () bool {return .loc >= 0}func ( *reverseIterator) () uint16 {:= .slice[.loc].loc--return}type arrayContainerUnsetIterator struct {content []uint16// pos is the index of the next set bit that is >= nextVal.// When nextVal reaches content[pos], pos is incremented.pos intnextVal int}func ( *arrayContainerUnsetIterator) () uint16 {:= .nextVal.nextVal++for .pos < len(.content) && uint16(.nextVal) >= .content[.pos] {.nextVal++.pos++}return uint16()}func ( *arrayContainerUnsetIterator) () bool {return .nextVal < 65536}func ( *arrayContainerUnsetIterator) () uint16 {return uint16(.nextVal)}func ( *arrayContainerUnsetIterator) ( uint16) {if !.hasNext() || .peekNext() >= {return}.nextVal = int().pos = binarySearch(.content, )if .pos < 0 {.pos = -.pos - 1}for .pos < len(.content) && uint16(.nextVal) >= .content[.pos] {.nextVal++.pos++}}func newArrayContainerUnsetIterator( []uint16) *arrayContainerUnsetIterator {:= &arrayContainerUnsetIterator{content: , pos: 0, nextVal: 0}for .pos < len(.content) && uint16(.nextVal) >= .content[.pos] {.nextVal++.pos++}return}
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |